<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>

<!DOCTYPE HTML>

<html xmlns:c="http://java.sun.com/jsp/jstl/core">

<head>
	<!-- CSS-Dateien verknÃ¼pfen -->
	<link type="text/css" rel="stylesheet" href="<c:url value="/resources/style/login.css"/>" />

    <title>Login</title>
</head>
<body>
	<!-- Header mit Menüleiste -->
	<%@ include file="./header.jsp" %>

	<!-- Login-Formular -->
        <div id="form_wrapper" class="form_wrapper">
        	<c:choose>
            	<c:when test="${param.type == 1}">
            		<form class="register active" method="post" action="<c:url value="/doRegister"/> " name="register">
            	</c:when>
            	<c:otherwise>
            		<form class="register" method="post" action="<c:url value="/doRegister"/> " name="register">
            	</c:otherwise>
            </c:choose>
                <h3>Registrieren</h3>
                <div class="column">
                    <div>
                        <label>Vorname:</label>
                        <input type="text" name="vorname" id="vorname"/>
                        <p class="error smallError" id="vornameError"></p>
                    </div>
                    <div>
                        <label>Nachname:</label>
                        <input type="text" name="nachname" id="nachname"/>
                        <p class="error smallError" id="nachnameError"></p>
                    </div>
                    <div>
                        <label>E-Mail:</label>
                        <input type="text" name="email" id="email"/>
                        <p class="error smallError" id="emailError"></p>
                    </div>
                </div>
                <div class="column">
                    <div>
                        <label>Username:</label>
                        <input type="text" name="username_reg" id="username_reg"/>
                        <p class="error smallError" id="username_regError"></p>
                    </div>
                    <div>
                        <label>Passwort:</label>
                        <input type="password" name="passwort_reg" id="passwort_reg"/>
                        <p class="error smallError" id="passwort_regError"></p>
                    </div>
                    <div>
                        <label>Passwort wiederholen:</label>
                        <input type="password" name="passwort_wdh" id="passwort_wdh"/>
                        <p class="error smallError" id="passwort_wdhError"></p>
                    </div>
                </div>
                <c:if test="${regErrorText != null}">
                	<p class="error" id="generalError">${regErrorText}</p>
                </c:if>
                <div class="bottom">
                    <input type="submit" value="Registrieren" />
                    <a href="<c:url value="/login?type=2"/> " rel="login" class="linkform">
                        Hast du schon einen Account? Hier einloggen
                    </a>
                    <div class="clear"></div>
                </div>

            </form>
			
			<c:choose>
				<c:when test="${param.type == 1}">
            		<form class="login" method="post" action="<c:url value="/doLogin"/> " name="login">
            	</c:when>
            	<c:otherwise>
            		<form class="login active" method="post" action="<c:url value="/doLogin"/> " name="login">
            	</c:otherwise>
            </c:choose>
                <h3>Login</h3>
                <div>
                    <label>Username:</label>
                    <input type="text" name="username_log" id="username_log"/>
                </div>
                <div>
                    <label>Passwort:</label>
                    <input type="password" name="passwort_log" id="passwort_log"/>
                </div>
                <c:if test="${logErrorText != null}">
                	<p class="error" id="generalError">${logErrorText}</p>
                </c:if>
                <div class="bottom">
                    <input type="submit" value="Login"></input>
                    <a href="<c:url value="/login?type=1"/>" rel="register" class="linkform">
                        Noch keinen Account? Hier registrieren
                    </a>
                    <div class="clear"></div>
                </div>
                <input type="hidden" name="requestedUri" value="${requestedUri}" />
            </form>
    </div>
    <!-- Content Ende -->
    


	<!-- Seitenfooter -->
	<%@ include file="./footer.jsp" %>

	<!--  JQuery & JavaScript Scripte einbinden -->
    <script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script>
    <script type="text/javascript" src="<c:url value="/resources/script/standard.js"/>"></script>
    <script type="text/javascript" src="<c:url value="/resources/script/login.js"/>"></script>
</body>
</html>